package homework.day11;

import java.util.Comparator;
import java.util.Objects;

public class  Book  implements Comparator {
    private Integer id;
    private String bookName;
    private String author;
    private Double Price;

    public Book() {
    }

    public Book(Integer id, String bookName, String author, Double price) {
        this.id = id;
        this.bookName = bookName;
        this.author = author;
        Price = price;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getBookName() {
        return bookName;
    }

    public void setBookName(String bookName) {
        this.bookName = bookName;
    }

    public String getAuthor() {
        return author;
    }

    public void setAuthor(String author) {
        this.author = author;
    }

    public Double getPrice() {
        return Price;
    }

    public void setPrice(Double price) {
        Price = price;
    }

    @Override
    public String toString() {
        final StringBuffer sb = new StringBuffer("Book{");
        sb.append("id=").append(id);
        sb.append(", bookName='").append(bookName).append('\'');
        sb.append(", author='").append(author).append('\'');
        sb.append(", Price=").append(Price);
        sb.append('}');
        return sb.toString();
    }

    @Override
    public int compare(Object o1, Object o2) {
        return 0;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Book book = (Book) o;
        return id.equals(book.id) &&
                Objects.equals(bookName, book.bookName) &&
                Objects.equals(author, book.author) &&
                Objects.equals(Price, book.Price);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, bookName, author, Price);
    }
}
